/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author allankv
 */
@Entity
@Table(name = "family")
@NamedQueries({
    @NamedQuery(name = "Family.findAll", query = "SELECT f FROM Family f"),
    @NamedQuery(name = "Family.findByIdfamily", query = "SELECT f FROM Family f WHERE f.idfamily = :idfamily"),
    @NamedQuery(name = "Family.findByFamily", query = "SELECT f FROM Family f WHERE f.family = :family")})
public class Family implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idfamily")
    private Integer idfamily;
    @Basic(optional = false)
    @Column(name = "family")
    private String family;
    @OneToMany(mappedBy = "family", fetch = FetchType.LAZY)
    private List<Taxonomicelement> taxonomicelementList;

    public Family() {
    }

    public Family(Integer idfamily) {
        this.idfamily = idfamily;
    }

    public Family(Integer idfamily, String family) {
        this.idfamily = idfamily;
        this.family = family;
    }

    public Integer getIdfamily() {
        return idfamily;
    }

    public void setIdfamily(Integer idfamily) {
        this.idfamily = idfamily;
    }

    public String getFamily() {
        return family;
    }

    public void setFamily(String family) {
        this.family = family;
    }

    public List<Taxonomicelement> getTaxonomicelementList() {
        return taxonomicelementList;
    }

    public void setTaxonomicelementList(List<Taxonomicelement> taxonomicelementList) {
        this.taxonomicelementList = taxonomicelementList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idfamily != null ? idfamily.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Family)) {
            return false;
        }
        Family other = (Family) object;
        if ((this.idfamily == null && other.idfamily != null) || (this.idfamily != null && !this.idfamily.equals(other.idfamily))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityBeans.Family[idfamily=" + idfamily + "]";
    }

}
